---
layout: m1x_soap
title: Product Tag Add
---

<h3><a name="product_tag.add-Module%3ATagApi"></a>Module: Tag Api</h3>

<h4><a name="product_tag.add-Resource%3Acatalogproducttag"></a>Resource: catalog_product_tag</h4>

<p><b>Aliases</b>: product_tag</p>


<h5><a name="product_tag.add-Method%3A"></a>Method:</h5>

<ul>
	<li>catalog_product_tag.add (SOAP V1)</li>
	<li>catalogProductTagAdd (SOAP V2)</li>
</ul>


<p>Allows you to add one or more tags to a product.</p>

<p><b>Arguments:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId </td>
<td> Session ID </td>
</tr>
<tr>
<td> array </td>
<td> data </td>
<td> Array of catalogProductTagAddEntity </td>
</tr>
</tbody></table>


<p><b>Return:</b></p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> array </td>
<td> result </td>
<td> Associative array of added tags with the tag name as a key and the tag ID as a value </td>
</tr>
</tbody></table>


<p>The <b>catalogProductTagAddEntity</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> tag <br class="atl-forced-newline" /> </td>
<td> Tag to be added (can contain several tags separated with white spaces). A tag that contains several words should be enclosed in single quotes. <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> product_id <br class="atl-forced-newline" /> </td>
<td> Product ID </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> customer_id <br class="atl-forced-newline" /> </td>
<td> Customer ID </td>
</tr>
<tr>
<td> string <br class="atl-forced-newline" /> </td>
<td> store <br class="atl-forced-newline" /> </td>
<td> Store ID </td>
</tr>
</tbody></table>

<p><b>Faults:</b></p>

<table><tbody>
<tr>
<th> Fault Code </th>
<th> Fault Message </th>
</tr>
<tr>
<td> 101 </td>
<td> Requested store does not exist. </td>
</tr>
<tr>
<td> 102 </td>
<td> Requested product does not exist. </td>
</tr>
<tr>
<td> 103 </td>
<td> Requested customer does not exist. </td>
</tr>
<tr>
<td> 105 </td>
<td> Provided data is invalid. </td>
</tr>
<tr>
<td> 106 </td>
<td> Error while saving tag. Details in error message. </td>
</tr>
</tbody></table>


<h4><a name="product_tag.add-Examples"></a>Examples</h4>

<h5><a name="product_tag.add-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy-&gt;login('apiUser', 'apiKey');
$data = array('product_id' =&gt; 2, 'store' =&gt; 'default', 'customer_id' =&gt; 10002, 'tag' =&gt; "First 'Second tag' Third");
echo "Adding Tag... ";
$addResult = $proxy-&gt;call(
    $sessionId,
    "product_tag.add",
    array($data)
);
echo ((count($addResult) == 3) ? "Done!" : "Fail!");
echo "&lt;br /&gt;";
print_r($addResult);</pre>
		</div>
</div></div>


<h5><a name="product_tag.add-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$sessionId = $proxy-&gt;login('apiUser', 'apiKey');

$result = $proxy-&gt;catalogProductTagAdd($sessionId, array(
'tag' =&gt; 'album',
'product_id' =&gt; '3',
'customer_id' =&gt; '1',
'store' =&gt; '0'
));
var_dump($result);</pre>
		</div>
</div></div>


<h5><a name="product_tag.add-RequestExampleSOAPV2%28WSIComplianceMode%29"></a>Request Example SOAP V2 (WS-I Compliance Mode)</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$sessionId = $proxy-&gt;login((object)array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey'));

$result = $proxy-&gt;catalogProductTagAdd((object)array('sessionId' =&gt; $sessionId-&gt;result, 'data' =&gt; ((object)array(
'tag' =&gt; 'album',
'product_id' =&gt; '3',
'customer_id' =&gt; '1',
'store' =&gt; '0'
))));
var_dump($result-&gt;result);</pre>
		</div>
</div></div>

<?php include(__ROOT__ . 'footer.php'); ?>
